import java.util.Map;
import java.util.HashMap;

class Stu implements Comparable<Stu>{
    HashMap<String, Object> hm;
    
    public Stu(HashMap<String, Object> hm){
        this.hm = new HashMap<String, Object>();
        this.hm.putAll(hm);
    }
    
    public int compareTo(Stu o){
        int ans1 = 0;
        for(Map.Entry<String, Object> entry : this.hm.entrySet()){
            if(entry.getKey().matches("score[0-9]{2}")){
                ans1 += (Integer)entry.getValue();
            }
        }
        
        int ans2 = 0;
        for(Map.Entry<String, Object> entry : o.hm.entrySet()){
            if(entry.getKey().matches("score[0-9]{2}")){
                ans2 += (Integer)entry.getValue();
            }
        }
        
        return ans1 - ans2;
    }
    
    public String toString(){
        String str = (String)hm.get("name");
        return str;
    }
}